#ifndef __LOTTERY_H__
#define __LOTTERY_H__

/*头文件*/
//------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//------------------------------------


/*宏定义*/
//------------------------------------
#define CODE_SIZE 16
#define USER_SIZE 12
#define LOTTERY_SIZE 5
#define LOTTERY_WIN_SIZE 3

//------------------------------------


/*结构体*/
//------------------------------------
#pragma pack(4)

typedef  struct winner
{
	int id;
	char name[USER_SIZE];
	char lottery_num[LOTTERY_SIZE];
	struct winner* next;
}winner_list;

typedef struct
{
	int balance;  //余额
	char name[USER_SIZE];
	char pwd[CODE_SIZE];
} User;

typedef struct
{
	char name[USER_SIZE];
	char lottery_num[LOTTERY_SIZE];
	int id; 
	int issue_version;
	int issue_status;
	int prize_status;
	int prize_gain;
} xLottery;

#pragma pack()
//------------------------------------

/*使用文件，文件指针*/
//------------------------------------
extern char* user_info;
extern char* lottery_info;
extern char* lottery_man;
extern char* prize_pool;
extern FILE* f_prize_pool;
extern FILE* f_lottery_man;
//------------------------------------

/*函数声明*/
//------------------------------------
void init(void);
void menu(void);
void issue(xLottery* plots,winner_list* winner_list_arr[],char* sissue, int mode);
void update_user_info(winner_list* winner_list_arr[],float award[]);
void update_lottery_info(winner_list* winner_list_arr[],float award[]);
void share(winner_list* winner_list_arr[],char* sissue);
void show_winners(void);
void list_insert(winner_list* head_node, xLottery* plots);
int list_find(winner_list* cur_node, char name[USER_SIZE]);
void show_issued(int IFissued);


//------------------------------------


/*全局变量声明*/
//------------------------------------
extern int QIHAO, perPrice_lottery, STATE,\
			NEXT_AWARD_POOL,GREAT_AWARD,\
			MIDDLE_AWARD,SMALL_AWARD,PRIZE_POOL;
//------------------------------------

#endif
